package com.test.t1;

import com.test.bean.Car;
import com.test.config.MainConfigOfLifeCycle;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/11/28 17:20
 */
public class IOCTest_LifeCycle {
    @Test
    public void test01() {
        //1.初始化容器
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfigOfLifeCycle.class);
        System.out.println("容器创建完成...");

        Car car = context.getBean("car", Car.class);

        //2.关闭容器
        context.close();
    }

    @Test
    public void test02() {
        //1.初始化容器
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfigOfLifeCycle.class);
        System.out.println("容器创建完成...");
        //2.关闭容器
        context.close();
    }


}
